Skip to content

Bluetooth: CAP: Implement handover procedures #85642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Feb 12, 2025

Implements the handover procedures, as per the Bluetooth CAP specificiation.

Fixes #47313

@Thalley Thalley force-pushed the cap_handover branch 3 times, most recently from 4ef45c7 to ae9d7b8 Compare April 7, 2025 13:14
@Thalley Thalley force-pushed the cap_handover branch 2 times, most recently from b233435 to 3157de2 Compare May 7, 2025 20:51
@Thalley Thalley force-pushed the cap_handover branch 11 times, most recently from d331e58 to dbe3d65 Compare May 23, 2025 15:47
Thalley added 2 commits May 23, 2025 18:12
Adds a new abstract struct for unicast group that is
specific for CAP. The difference between this and the BAP
unicast group, is that the parameters are CAP streams and
thus ensuring that the streams in the group adhere to the
additional requirements that CAP has on top of BAP.

This also adds foreach functions for both CAP and BAP
to allow users to iterate on the streams in the
abstract groups.

Various samples, modules and tests have been updated
to use the CAP struct and API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_le_ext_adv_info struct has been extended to also
contain the advertising and periodic advertising states.

Additionally, the function verifies the input to avoid
NULL pointer access, and the addr field is more
properly documented.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Thalley added 2 commits May 24, 2025 16:34
Add a common function, start_broadcast_adv, to start
broadcast advertisement in the LE Audio BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a common definition of the TEST_SAMPLE_SIRK used by
the BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
@Thalley Thalley force-pushed the cap_handover branch 2 times, most recently from 690db3b to 096bb4b Compare May 24, 2025 16:26
Implement the unicast to broadcast handover procedure,
as per the Bluetooth CAP specificiation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Copy link

@Thalley Thalley requested a review from Copilot May 25, 2025 12:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the handover procedures defined in the Bluetooth CAP specification while also refactoring and unifying unicast group APIs (renaming many bap_ functions to cap_ functions) across tests, host, and sample applications.

  • Replaces manual extended/periodic advertising start calls with a common helper (start_broadcast_adv) in tests.
  • Introduces new CAP unicast group API functions (create, reconfig, add_streams, delete, foreach_stream) with handover support.
  • Updates samples, shell commands, and related configuration to support the new handover procedures.

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c Replaces explicit advertising start calls with start_broadcast_adv, consolidating error handling.
tests/bsim/bluetooth/audio/src/bap_bass_broadcaster_test.c Similar consolidation of advertising start logic via start_broadcast_adv.
tests/bluetooth/audio/mocks/src/kernel.c Adds additional fake definitions to support semaphore operations in tests.
tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c Implements CAP unicast group API functions with a static unicast group instance.
tests/bluetooth/audio/cap_initiator/src/test_unicast_group.c Adds comprehensive tests for the new CAP unicast group APIs with detailed error cases.
subsys/bluetooth/host/shell/bt.c & adv.c Updates shell commands and adv info reporting to include new extended/periodic advertising states.
subsys/bluetooth/audio/shell/cap_initiator.c Refactors unicast client shell command API calls to use CAP-specific functions.
subsys/bluetooth/audio/cap_internal.h, cap_common.c, cap_commander.c Introduces handover-specific procedure states and helper functions for managing CAP procedures.
subsys/bluetooth/audio/bap_unicast_client.c Updates unicast group validation and adds a foreach_stream iterator with logging.
Kconfig.cap Adds configuration support for CAP handover.
Samples & Include files (cap_initiator.c, cap_initiator_unicast.c, bluetooth.h, cap.h, bap.h, release notes) Updates API usage and documentation to reflect CAP handover and API renaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LE Audio: CAP Initiator audio handover Implementation
1 participant